import 'package:flutter/cupertino.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class RefreshFooter extends StatelessWidget {
  const RefreshFooter({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return CustomFooter(
      builder: (context, loadStatus) {
        Widget body;
        if (loadStatus == LoadStatus.idle) {
          body = const Text('上拉加载');
        } else if (loadStatus == LoadStatus.canLoading) {
          body = const Text('松开加载更多');
        } else if (loadStatus == LoadStatus.loading) {
          body = const CupertinoActivityIndicator();
        } else if (loadStatus == LoadStatus.noMore) {
          body = const Text('没有更多了');
        } else {
          body = const Text('加载失败，点击重试');
        }
        return Center(child: body);
      },
    );
  }
}
